"""

@author: baoq
@email: q.bao@hzgosun.com
@file: policeIncidentManageTest.py
@time: 2019/5/11 15:57

警情管理测试用例

"""


import unittest
from time import sleep

from common.functions import save_screenshot
from common.decorators import mkdir_classname, log4gs
from common.settings import TAG
from pages_example.macManagePage import MacManagePage


@log4gs
@mkdir_classname(TAG)
class MacManageTest(unittest.TestCase):
    """MAC数据清洗功能测试"""
    @classmethod
    def setUpClass(cls):
        cls.log.info('=' * 30 + "开始MAC数据清洗功能测试({})".format(__class__.__name__) + '=' * 30)
        cls.page = MacManagePage('/PopcManage/MacManage')

    @classmethod
    def tearDownClass(cls):
        cls.log.info('=' * 30 + "结束MAC数据清洗功能测试({})".format(__class__.__name__) + '=' * 30)
        cls.page.driver.quit()

    def setUp(self):
        self.log.info('>>>>>开始执行用例：{} {}'.format(self.id(), self.shortDescription()))

    def tearDown(self):
        self.log.info('<<<<<结束执行用例：{} {}'.format(self.id(), self.shortDescription()))

    @unittest.skip
    def test_abc1(self):
        """举例：点击表头里面的checkbox"""
        self.page.searchTools.search_btn.click()
        sleep(1)
        self.page.table.checkbox.click()
        sleep(1)

    @unittest.skip
    def test_abc2(self):
        """举例：点击查询结果里面某行的checkbox"""
        row = self.page.table.get_row('86:88:88:88:88:88')
        try:
            row_checkbox = row.find_element_by_class_name('ivu-checkbox-input')
            row_checkbox.click()
        except Exception:
            self.log.error("没有找到checkbox")
        sleep(1)

    def test_abc3(self):
        """举例：开始时间和结束时间同一个label，并清除时间"""
        self.page.searchTools.start_time.send_keys('2016-05-02 00:00:00')
        sleep(1)
        self.page.searchTools.end_time.send_keys('2019-05-29 00:00:00')
        sleep(1)
        self.page.searchTools.start_time.clear()
        sleep(1)



if __name__ == '__main__':
    unittest.main()